﻿<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"  x:Class="IndexMarkSilverlightClient.Views.Controls.ReportsControls.VolumsPPSView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    xmlns:repcontrols="clr-namespace:IndexMarkSilverlightClient.Views.Controls.ReportsControls"  xmlns:clases="clr-namespace:IndexMarkSilverlightClient.Classes" xmlns:converters="clr-namespace:IndexMarkSilverlightClient.Classes.Converters" xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls" mc:Ignorable="d" 
    d:DesignHeight="600" d:DesignWidth="800">
    
    <UserControl.Resources>
        <Style TargetType="Button" x:Key="ActionButtonStyle">
            <Setter Property="Margin" Value="3"/>
            <Setter Property="Width" Value="24"/>
            <Setter Property="Height" Value="24"/>
        </Style>

        <Style TargetType="Button" x:Key="MiniActionButtonStyle">
            <Setter Property="Margin" Value="2"/>
            <Setter Property="Width" Value="20"/>
            <Setter Property="Height" Value="20"/>
        </Style>
        <converters:RespDepToImageConverter x:Key="RespDepToImageConverter"/>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
           
            <RowDefinition Height="150" MaxHeight="150"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        

            <!--<Button Style="{StaticResource ActionButtonStyle}" x:Name="Refresh">
                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/Refresh.png"/>
            </Button>

            <Button Style="{StaticResource ActionButtonStyle}" x:Name="Export">
                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/microsoftofficeexcel.png"/>
            </Button>-->
    
            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
                    <TextBlock Text="Преподаватели" Margin="2"/>
                        <StackPanel Orientation="Horizontal" Margin="2" Height="120">

                            <!--<repcontrols:USTUTreeView Height="120" Width="270" MaxWidth="370" x:Name="USTUTree"/>-->
                            <controls:TreeView x:Name="USTUTree" ItemsSource="{Binding}" VirtualizingStackPanel.VirtualizationMode="Recycling" 
                                               Background="White" BorderBrush="Transparent" BorderThickness="0" Height="Auto" 
                                               ScrollViewer.VerticalScrollBarVisibility="Auto" MinHeight="100" MinWidth="150" Width="263">
                                <controls:TreeView.ItemTemplate>
                                    <common:HierarchicalDataTemplate ItemsSource="{Binding Childs}">
                                        <StackPanel Orientation = "Horizontal">
                                            <Image Source="{Binding Path=TypeObject, Converter={StaticResource RespDepToImageConverter}}" Width="20" Height="20"/>
                                            <CheckBox ClickMode="Release" IsChecked="{Binding Check, Mode=TwoWay}" Content="{Binding}" Click="CheckBox_Click"/>
                                        </StackPanel>
                                    </common:HierarchicalDataTemplate>
                                </controls:TreeView.ItemTemplate>
                            </controls:TreeView>
                        <Button Style="{StaticResource MiniActionButtonStyle}" x:Name="FlushPPS" Click="FlushPPS_Click">
                                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/UnselectAll.png"/>
                            </Button>
                        </StackPanel>
                </StackPanel>
            
            <controls:GridSplitter Width="4" Grid.Column="0" VerticalAlignment="Stretch" Background="CornflowerBlue" BorderBrush="Transparent" BorderThickness="0"/>
            
            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="0">
                    <TextBlock Text="Разделы ИС" Margin="2"/>
                    <StackPanel Orientation="Horizontal" Margin="2">

                        <controls:TreeView Height="120" Width="170" x:Name="SectionsTree" ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Auto">
                            <controls:TreeView.ItemTemplate>
                                <DataTemplate>
                                    <CheckBox ClickMode="Release" IsChecked="{Binding Check, Mode=TwoWay}" Content="{Binding}" Click="CheckBox_Click" />
                                </DataTemplate>
                            </controls:TreeView.ItemTemplate>
                        </controls:TreeView>

                        <StackPanel Orientation="Vertical">
                            <Button Style="{StaticResource MiniActionButtonStyle}" x:Name="SelectSections" ToolTipService.ToolTip="Выделить все" Click="SelectSections_Click">
                                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/SelectAll.png" ImageFailed="Image_ImageFailed" />
                            </Button>
                            <Button Style="{StaticResource MiniActionButtonStyle}" x:Name="UnselectSections" ToolTipService.ToolTip="Снять все" Click="UnselectSections_Click">
                                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/UnselectAll.png"/>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            
            <controls:GridSplitter Width="4" Grid.Row="0" Grid.Column="1" VerticalAlignment="Stretch" Background="CornflowerBlue" BorderBrush="Transparent" BorderThickness="0" />

            <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch"  Grid.Column="2" Grid.Row="0">
                    <TextBlock Text="Категории ИС" Margin="2"/>
                    <StackPanel Orientation="Horizontal" Margin="2">

                        <!--<repcontrols:CategoryCheckListBox Height="100" Width="170" x:Name="CatLB"/>-->
                        <ListBox x:Name="CategoryLB" Background="White" ItemsSource="{Binding}" ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                 ScrollViewer.HorizontalScrollBarVisibility="Auto" MaxHeight="400" MinWidth="150" BorderBrush="Transparent" BorderThickness="0"
                                 MinHeight="120">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <CheckBox IsChecked="{Binding Check, Mode=TwoWay}" Content="{Binding Name}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <StackPanel Orientation="Vertical">
                            <Button Style="{StaticResource MiniActionButtonStyle}" x:Name="SelectCats" Click="SelectCats_Click" ToolTipService.ToolTip="Выделить все">
                                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/SelectAll.png"/>
                            </Button>
                            <Button Style="{StaticResource MiniActionButtonStyle}" x:Name="UnselectCats" Click="UnselectCats_Click" ToolTipService.ToolTip="Снять все">
                                <Image Source="/IndexMarkSilverlightClient;component/Views/Resources/UnselectAll.png"/>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>


        <controls:GridSplitter Height="6" Grid.Row="0" Grid.ColumnSpan="3" VerticalAlignment="Bottom" Background="CornflowerBlue" BorderBrush="Transparent" BorderThickness="0" HorizontalAlignment="Stretch" />
        
        <data:DataGrid Grid.Row="1"/>

        <clases:xDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" IsReadOnly="True" ItemsSource="{Binding}" AutoGenerateColumns="False" x:Name="IndexGrid" LoadingRowGroup="IndexGrid_LoadingRowGroup" SelectionMode="Single">
            <clases:xDataGrid.Columns>
                <data:DataGridTextColumn Header="№" Binding="{Binding OrderField}" />
                <!--<data: Header="ФИО" Binding="{Binding Resp.Person}"/>-->
                <data:DataGridTemplateColumn Header="ФИО">
                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <HyperlinkButton Content="{Binding Resp.Person}" Click="HyperlinkButton_Click"  HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
                        </DataTemplate>
                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>
                <!--<data:DataGridTextColumn Header="Кафедра" Binding="{Binding Resp.Department.Abbriviation}"/>-->
                <!--<data:DataGridTextColumn Header="Должность" Binding="{Binding Position}"/>-->
                <data:DataGridTextColumn Header="Итоговый индекс" Binding="{Binding Index}"/>
                <data:DataGridTemplateColumn Header="Индексы по категориям">
                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ListBox x:Name="ChildTable"   ItemsSource="{Binding SectionIndex}" >
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <controlsToolkit:WrapPanel/>
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Vertical" Width="45" HorizontalAlignment ="Center">
                                            <Border BorderBrush="LightBlue" BorderThickness="0,0,0,1">
                                                <TextBlock Text="{Binding Section}" HorizontalAlignment="Center"/>
                                            </Border>
                                            <TextBlock Text="{Binding Index}"  HorizontalAlignment="Center"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </DataTemplate>
                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>

                <data:DataGridTextColumn Header="Индекс гармонии" Binding="{Binding IndexHarmony}"/>
                <data:DataGridTextColumn Header="Индекс лидерства" Binding="{Binding IndexLider}"/>
            </clases:xDataGrid.Columns>
        </clases:xDataGrid>

    </Grid>
</UserControl>
